package com.inspur.dgov.bsp.application.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.inspur.dgov.bsp.application.entity.PubRole;
import com.inspur.dgov.common.tool.node.INode;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
* 角色信息视图实体类
*
* @Author chiyupei
* @Date 19/9/25 下午4:04
* @Version 1.0
* @Description 角色信息视图实体类
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "角色信息对象", description = "角色信息视图实体类")
public class RoleVO extends PubRole implements INode {

   private static final long serialVersionUID = 1L;

   /**
    * 角色ID
    */
   private Long id;

   /**
    * 上级角色ID
    */
   private Long parentId;

   /**
    * 子孙节点
    */
   @JsonInclude(JsonInclude.Include.NON_EMPTY)
   private List<INode> children;

   @Override
   public List<INode> getChildren() {
       if (this.children == null) {
           this.children = new ArrayList<>();
       }
       return this.children;
   }

   /**
    * 上级角色
    */
   private String parentName;

   /**
    * 所属租户
    */
   private String tenantName;
}
